<!doctype html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>申请试吃</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/base.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/cart.css" />
    <style type="text/css">
        .word .apply02 {
            padding-right: 10px;
        }
        .attention{ position:fixed; width:100%; max-width:640px; height:50px; top:0px; background:rgba(0,0,0,0.5); overflow:hidden; zoom:1; z-index:101;}
        .attention .logo{ position:absolute; left:15px;}
        .attention .logo>img{ display:block; width:40px; height:40px; float:left; margin-top:5px;}
        .attention .logo h3{ margin-left:50px; height:50px; line-height:50px; font-weight:normal; font-size:15px; color:#fff;}
        .attention .logo p{ margin-left:30px;margin-top:4px; font-size:13px; color:#7c7c7c;}
        .attention i{ display:block; width:80px; height:30px; position:absolute; top:10px; right:15px;}
        .attention i input{ display:block; border:none; width:80px; height:30px; border-radius:2px; background:#00bd12; color:#fff; font-size:13px; appearance:none; -webkit-appearance:none;border-radius:0;}
    </style>
</head>
<body>
<div class="prodetail" <neq name="state" value="4">style="padding-bottom: 90px;"</neq>>
<if condition="$focus eq 0">
    <div class="attention">
        <div class="logo">
            <img src="__PUBLIC__/Wx/img/logo02.png"/>
            <h3>乡土味士</h3>
        </div>
        <i><input type="button" value="立即关注" class="gz"/></i>
    </div>
</if>
<div class="proname-dh">
    <!--<h1><img src="__PUBLIC__/Wx/images/pic62.jpg"/></h1>-->
    <h1><img src="<?= isMorePic($h_imgs)?>"/></h1>
    <h2 style="font-size: 16px">{$title} {$u_num}<?=getunit($unit)?></h2>
</div>
<div class="intro">
    <p>数量：<span class="foretaste_num">{$num}</span>份<!--（当天兑完为止）<a href="#">获得积分</a>--><em><b>{$price}</b>积分</em></p>
</div>
<div class="word">
    <h3><span>试吃申请流程</span><!--<em onClick="window.location='__MODULE__/Foretaste/helppoor'">参选扶贫大使</em>--><!--<em onClick="window.location='__MODULE__/WishGroup/index'">获取更多积分</em>--></h3>
    <p><i></i><span>提交试吃申请后，24小时内；</span></p>
    <p><i></i><span>最快邀请8名好友完成点赞的前三名用户，可获得试吃商品；</span></p>
    <p><i></i><span>试吃商品可在社区店直接领取，每位用户每周仅限领取1次；</span></p>
    <!--<p><i></i><span>试吃后发布试吃评论，根据评论<input type="button" onClick="window.location='__MODULE__/Foretaste/helppoor'" style="width: 60px;height: 20px;background: #f97a0a;color: #ffffff;text-align: center;line-height: 20px;" value="集赞排名">当选社区扶贫大使免费恩施3天游。</span></p>-->
    <p><i></i><span>申请试吃失败的用户，积分原路退回。</span></p>
    <!--<p><i></i><span>试吃排名可在会员中心查看。</span></p>-->
    <p><i></i><span>(提示：试吃<!--、扶贫大使，-->仅限武汉参加)</span></p>

</div>
<div class="prointro03">
    <div class="tabber04"><span class="on">商品详情</span><span>申请队列</span><span>试吃评论</span></div>
    <div id="content">
        <!--                    商品详情                          -->
        <div class="block propic">
            <div class="intro"><img src="<?= isMorePic($c_imgs)?>"/></div>
        </div>
        <!--                    申请队列                          -->
        <div class="block list-sc" style="display:none;margin-top:10px; ">
            <div class="sclist">
                <ul>
                    <volist name="order" id="vo">
                        <li onclick="window.location='__MODULE__/Foretaste/foretaster/oid/{$vo.id}'">
                            <div class="pic"><img src="{$vo.avatar}"/></div>
                            <div class="jd">
                                <h2><span>{$vo.nickname}</span><if condition="$vo['usetime'] neq 0"><b>完成用时：{$vo['str_time']}</b></if></h2>
                                <p><span style="width:{$vo.pre}%"></span><b>{$vo.population}人点赞</b><i>{$vo.pre}%</i></p>
                            </div>
                        </li>
                    </volist>
                </ul>
            </div>
        </div>
        <!--                    试吃评论                          -->
        <div class="block comment" style="display:none;">
            <if condition="empty($list) neq true">
                <ul>
                    <volist name="list" id="vo">
                        <li>
                            <div class="top" onClick="window.location='__MODULE__/ForetasteEvaluate/commentdetail/e_id/{$vo.id}'">
                                <div class="pic"><img src="<?=$vo['avatar']?>"/></div>
                                <h3><?=$vo['nickname']?></h3><b><?=$vo['hometown']?></b><time>{$vo.addtime|date="Y-m-d",###}</time>
                            </div>
                            <div class="wz">
                                <p><?=$vo['content']?></p>
                                <p>
                                    <volist name="vo.pic" id="v">
                                        <img src="<?=$v?>" />
                                    </volist>
                                </p>
                            </div>
                            <div class="number">
                                <span class="zan" data-id="{$vo.id}" data-table="foretaste_evaluate"><?=$vo['like_num']?></span>
                                <span style="background:url(__PUBLIC__/Wx/img/comm.png) no-repeat left center; background-size:20px 20px;" onClick="window.location='__MODULE__/ForetasteEvaluate/commentdetail/e_id/{$vo.id}'"><?=$vo['comm_num']?></span>
                            </div>
                        </li>
                    </volist>
                    <li><a href="__MODULE__/ForetasteEvaluate/index/gid/{$id}">查看更多</a></li>
                </ul>
            </if>
        </div>
    </div>
</div>
<neq name="state" value="4">
    <if condition="$totime">
        <div class="time" id="time"><i>限时申请</i><if condition="$starttime gt time()"><span>距离商品上架还剩</span><else /><span>距离活动结束还剩</span></if>
            <div class="time-item">
                <if condition="floor($totime /(60 * 60 * 24)) neq 0"><span id="day_show">0</span>天</if><strong id="hour_show"><s id="h"></s>0</strong>时<strong id="minute_show"><s></s>00</strong>分<strong id="second_show"><s></s>00</strong>秒
            </div>
        </div>
    </if>
</neq>
<switch name="state">
    <case value="1">
        <if condition="$starttime elt time()">
            <!--开始-->
            <div class="button02"><input type="button" value="立即申请" onClick="apply()"/></div>
            <else />
            <!--未开始-->
            <div class="button02"><input type="button" value="即将上架"  onclick="window.location.href='__MODULE__/Foretaste/index'"/></div>
        </if>
    </case>
    <case value="4">
        <!--已结束-->
        <div class="button02"><input type="button" value="活动结束"  onclick="window.location.href='__MODULE__/Foretaste/index'"/></div>
    </case>
</switch>
<div class="note05">
    <div class="shadow">
        <i class="gb">关闭</i>
        <div class="choose">
            <h2>温馨提示</h2>
            <p class="prompt_text">---------</p>
            <div class="sure01"><input type="button" value="确认" class="left" style="width: 100%;background: #f97a0a;" onclick="window.location.href='__MODULE__/User/index'"/><!--<input type="button" value="退出"  onclick="window.location.href='__MODULE__/Index/index'" />--></div>
        </div>
    </div>
</div>
<div class="hint">
    <div class="shadow" style="height:140px; margin-top:-70px;">
        <div class="close"></div>
        <div class="succeed">
            <h2>温馨提示</h2>
            <p>你还未进行<b>个人信息认证</b>，无法参与，<b>立即进行个人信息认证</b></p>
            <p style="padding:0; height:40px; position:absolute; width:100%; bottom:0;"><input type="button" value="个人信息认证" class="right"  onclick="window.location.href='__MODULE__/Authentication/index'"/><input type="button" value="取消" class="left"/></p>
        </div>
    </div>
</div>
<div class="tc02">
    <div class="shadow">
        <i class="gb">关闭</i>
        <div class="succeed">
            <h2>温馨提示</h2>
            <p>对不起您的积分不足，无法参与</p>
            <!--<h3>您可以通过购买心愿卡获得积分</h3>-->
            <h3>您可以通过线下扫码支付或参加拼团可获得积分</h3>
            <p style="padding:0; height:40px; position:absolute; width:100%; bottom:0;"><!--<input type="button" value="参与帮扶农村心愿团" class="right"  onclick="window.location.href='__MODULE__/WishGroup/index'"/>--><input type="button" value="参与拼团" class="right"  onclick="window.location.href='__MODULE__/List/index'"/><input type="button" value="返回我的社区" class="left" onclick="window.location.href='__MODULE__/Index/index'"/></p>
        </div>
    </div>
</div>
<div class="page">
    <div class="close"></div>
    <div class="inner">
        <div class="pic"><img src="__PUBLIC__/Wx/images/pic14.jpg"/><p>长按图片【识别二维码】关注公众号</p></div>
        <div class="step">
            <h2>无法识别二维码</h2>
            <p>1.打开微信，点击“添加朋友”</p>
            <p>2.点击“公众号”</p>
            <p>3.搜索公众号：“乡土味士”</p>
            <p>4.点击：关注“，完成</p>
            <h5>精准扶贫 从我做起</h5>
        </div>
    </div>
</div>
</div>
<!--引用悬浮公共导航文件-->
<include file="Public:nav" />
<script  src="__PUBLIC__/Wx/js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
    $(".click span").click(function(){
        if($(this).text() ==="导航"){
            $(this).text("收起");
            $('.link02').css('display','block')
        }else{
            $(this).text("导航");
            $('.link02').css('display','none')
        }//end if
    });//end fun

    $('.gz').click(function(){
        $('.page').css('display','block')
    });
    $('.close').click(function(){
        $('.page').css('display','none')
    });

    //状态实时更新
    window.setInterval(function(){
        var gid = "{$id}";
        $.post('__MODULE__/Foretaste/reload',{id:gid},function(data){
            $(".foretaste_num").text(data.num);
            if (data.num == 0 || data.state != "{$state}"){
                window.location.reload();
            }//end if
        });
    },3000);

    function apply() {
        $.post('',{'op':'receive'},function (d) {
            if(d.val == 'member'){
                $('.hint').css('display','block');
            }else if(d.val == 'community'){
                $('.prompt_text').html('抱歉，此活动仅限武汉参加！');
                $('.prompt_text').css('text-align','center');
                $('.sure01').children().val('返回首页');
                $('.note05').css('display','block');
                $('.left').click(function () {
                    window.location.href="__MODULE__/Index/index";
                });
            }else if(d.val == 'order'){
                if(d.state == 0 ){
                    $('.prompt_text').html('您已提交产品试吃申请<br/>请去会员中心，查看我的试吃申请记录！');
                    $('.sure01').children().val('立即去查看');
                    $('.note05').css('display','block');
                    $('.left').click(function () {
                        window.location.href="__MODULE__/User/index";
                    });
                }else{
                    // $('.prompt_text').html('您本周已获得试吃产品，下周还可继续参加！<br/>发布试吃评论，参与社区扶贫大使评选！<br/>即有机会享恩施免费3日游！');
                    $('.prompt_text').html('您本周已获得试吃产品，下周还可继续参加！');
                    $('.prompt_text').css('margin','10px 20px 50px 20px');
                    $('.shadow').css('height','auto');
                    $('.sure01').children().val('立即发布试吃评价');
                    $('.note05').css('display','block');
                    $('.left').click(function () {
                        window.location.href="__MODULE__/User/index";
                    });
                }//end if

            }else if (d.val == 'credit'){
                $('.tc02 ').css('display','block');
            }else{
                window.location.href="__MODULE__/Foretaste/order/gid/{$id}"
            }//end if
        })
    }//end fun

    $('.close').click(function(){
        $('.hint').css('display','none')
    });
    $('.sure01 input').click(function(){
        $('.note05').css('display','none')
    });
    $('.gb').click(function(){
        $('.note05').css('display','none')
    });
    $('.gb').click(function(){
        $('.tc02 ').css('display','none')
    });
    $(document).ready(function(e) {
        $(".sc").click(function(){
            if($(this).hasClass("sc02")){
                $(this).removeClass("sc02");
            }else{
                $(this).addClass("sc02");
            }
        });
    });
    $('.tabber04 span').click(function(){
        $(this).addClass("on").siblings().removeClass()
        $("#content>.block").hide().eq($('.tabber04 span').index(this)).show();
    });
</script>
<script type="text/javascript">
    // 点赞&取消赞
    $(".zan").click(function(){
        var e_id = $(this).attr('data-id');
        var table = $(this).attr('data-table');
        var zan = $(this);
        var zan_num = zan.html();
        if($(this).hasClass("zan02")){
            $.post('/Wx/ForetasteEvaluate/cancleLike',{e_id:e_id,table:table},function (data) {
                zan.removeClass("zan02");
                zan.html(zan_num-1)
            })
        }else{
            $.post('/Wx/ForetasteEvaluate/addLike',{e_id:e_id,table:table},function (data) {
                zan.addClass("zan02");
                zan.html(zan_num*1+1)
            })

        }
    });
</script>
<if condition="$totime">
    <script type="text/javascript">
        var intDiff = parseInt("{$totime}");//倒计时总秒数量
        function timer(intDiff){
            window.setInterval(function(){
                var day=0,
                    hour=0,
                    minute=0,
                    second=0;//时间默认值
                if(intDiff > 0){
                    day = Math.floor(intDiff / (60 * 60 * 24));
                    hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
                    minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
                    second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
                }
                if (minute <= 9) minute = '0' + minute;
                if (second <= 9) second = '0' + second;
                $('#day_show').html(day);
                $('#hour_show').html('<s id="h"></s>'+hour+'');
                $('#minute_show').html('<s></s>'+minute+'');
                $('#second_show').html('<s></s>'+second+'');
                intDiff--;
                if(intDiff == 0 && "{$state}" == 1)window.location.reload();
            }, 1000);
        }
        $(function(){
            timer(intDiff);
        });
    </script>
</if>
<include file="Public/share" title="{$title}" desc="来乡土味士，吃天然菜，评选扶贫大使！" imgurl="{$h_imgs[0]}" />
</body>
</html>